Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David SE 6 posts 28 karma points
    Jan 22, 2015 @ 11:26
    David SE
    0

    MemberService.Created - Name of member returns login name [v7.2.1]

    Hey,

    When I create a member, I'd like to generate a member group name using the name of the newly created member. However, when I access the Entity.Name property I seem to get the login name. Is this a bug or by design?

    [code]
    //My ApplicationEventHandler implementation

    protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
    {
         MemberService.Created += OnMemberCreated;
    }

    private void OnMemberCreated(IMemberService sender, NewEventArgs arguments)
    {
            if (arguments.Alias == "Clients")
            {
                var memberGroupName = string.Format("{0} - {1}", arguments.Alias, arguments.Entity.Name);
                 sender.AssignRole(arguments.Entity.Id, memberGroupName);
            }
    }[/code]

     

    Thanks,
    David

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Jan 22, 2015 @ 12:35
    Jeroen Breuer
    0

    This blog package also shows the name: http://24days.in/umbraco/2014/managing-members/. Maybe the source code at the bottom can help.

    Jeroen

  • David SE 6 posts 28 karma points
    Jan 22, 2015 @ 14:16
    David SE
    0

    It looks like I'll have to use Examine in order to extract the node name. I thought the Entity.Name property would contain that information, but I guess not.

    Thanks!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies